<?php
// include_once dirname(__FILE__).'/../_config.php';

if(empty($_POST['checkcode']) || empty($_POST['username']) || empty($_POST['password'])){
	ajax_callback('warning', '参数不全', $callback = 'login_callback', '', $url ='', $ttl = 5000, 'top');
}

if(authnum_check() == false){
	ajax_callback('warning', '验证码不正确', $callback = 'login_callback', '', $url ='', $ttl = 5000, 'top');
}

$remember = empty($_POST['remember']) ? 0 : 1;	// 默认一天
##$__oManager = new Manager();
$r = $__oManager->login($_POST['username'], $_POST['password'], $remember);
if(!empty($r) && $r['result'] == 'succ'){	// 登录成功	
	ajax_callback('succ', '登录成功', $callback = 'login_callback', $r['js'], $url ='./m.php', $ttl = 1000, 'top');
}else{
	ajax_callback('error', $r['rmsg'], $callback = 'login_callback', '', $url ='', $ttl = 5000, 'top');
}
?>